package com.xiaomage.ViewDraw16

import android.content.Context
import android.graphics.BlurMaskFilter
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.view.View

/**
 * Created by Administrator on 2018/1/23.
 */
class MaskFilterView(context: Context):View(context) {
    private var paint=Paint()
    init {
        setLayerType(LAYER_TYPE_SOFTWARE,null)
        paint.color= Color.RED

    }

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        paint.setMaskFilter(BlurMaskFilter(5f, BlurMaskFilter.Blur.INNER))
        canvas.drawCircle(100f,100f,50f,paint)

        paint.setMaskFilter(BlurMaskFilter(5f, BlurMaskFilter.Blur.NORMAL))
        canvas.drawCircle(100f,300f,50f,paint)
        paint.setMaskFilter(BlurMaskFilter(5f, BlurMaskFilter.Blur.OUTER))
        canvas.drawCircle(100f,500f,50f,paint)
        paint.setMaskFilter(BlurMaskFilter(5f, BlurMaskFilter.Blur.SOLID))
        canvas.drawCircle(100f,700f,50f,paint)
    }
}